<template>
  <div class="home-swipe">
    <div class="top">
      <img src="../../common/logo/cloud_music_logo.svg" alt="" class="log_img">
      <div class="top_text">
        <span>发现音乐</span>
        <span>我的音乐</span>
        <span>关注</span>
        <span>商城</span>
      </div>
      <van-search class="search_input"
      v-model="value"
      placeholder="请输入搜索关键词"
      input-align="center"
      @search="onSearch"
    />
    </div>
    
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="(item, index) in bannerData" :key="index">
        <van-image :src="item.imageUrl" lazy-load />
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
import { Toast } from "vant";
export default {
  data() {
    return {
      value: "",
      bannerData: [],
    };
  },
  created() {
    this.getBanner();
  },
  methods: {
    getBanner() {
      this.$request("get", "/banner").then((res) => {
        // console.log(res);
        if (res.code == 200) {
          this.bannerData = res.banners;
        }
      });
    },
    onSearch(val) {
      Toast(val);
    },
  },
};
</script>

<style scoped>
.top{
  width: 100%;
}
.top_text{
  display: inline-block;
  width: 30%;
  height: 50px;
}
.top_text span{
  line-height: 50px;
  margin-left: 10px;
  margin-right: 10px;
  
}
.search_input{
  display: inline-block;
  width: 20%;
}
.log_img{
  display: inline-block;
  height: 40px;
  margin-bottom: -12px;
}
</style>